package com.teemo.dp.factorymethod.demo2;

import com.teemo.dp.factorymethod.demo2.computer.Computer;
import com.teemo.dp.factorymethod.demo2.computer.DesktopComputer;
import com.teemo.dp.factorymethod.demo2.computer.LaptopComputer;

/**
 * @author Teemo
 */
public class StaticFactory {

    public static Computer createComputer(String type) {
        switch (type) {
            case "laptop":
                LaptopComputer laptopComputer = new LaptopComputer();
                laptopComputer.setCpu("i5");
                laptopComputer.setMemory("8GB");
                laptopComputer.setHardDisk("256GB");
            case "desktop":
                DesktopComputer desktopComputer = new DesktopComputer();
                desktopComputer.setCpu("i7");
                desktopComputer.setMemory("16GB");
                desktopComputer.setHardDisk("1TB");
                return desktopComputer;
            default:
                return null;
        }
    }
}
